package cn.com.view;

import javax.swing.BorderFactory;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;

/**
 * title: 学生信息添加，修改
 * @author Administrator
 *
 */
public class StuFrame {

    private JPanel panel;//面板
    //标签
    private JLabel stunameLable,stuageLable,stuphoneLable,stuaddressLable;
    //文本框
    private JTextField stuname,stuage,stuphone,stuaddress;
    //按钮
    private JButton confirm,cancel;

    //构造器，构造面板
    public StuFrame(){

        //构造面板
        panel = new JPanel();
        //set title
        panel.setBorder( BorderFactory.createTitledBorder( "添加学生信息" ) );
        //set layout
        panel.setLayout( null );

        //构造标签
        stunameLable = new JLabel( "姓名" );
        stuageLable = new JLabel( "年龄" );
        stuphoneLable = new JLabel( "电话" );
        stuaddressLable = new JLabel( "地址" );

        //构造文本框
        stuname = new JTextField( 10 );
        stuage = new JTextField( 10 );
        stuphone = new JTextField( 10 );
        stuaddress = new JTextField( 10 );
        //构造按钮
        confirm = new JButton( "添加" );
        cancel = new JButton( "取消" );
        //设置组件位置
        stunameLable.setBounds( 30, 30, 60, 30 );
        stuname.setBounds( 70, 30, 160, 30 );

        stuageLable.setBounds( 30, 70, 60, 30 );
        stuage.setBounds( 70, 70, 160, 30 );

        stuphoneLable.setBounds( 30, 110, 60, 30 );
        stuphone.setBounds( 70, 110, 160, 30 );

        stuaddressLable.setBounds( 30, 150, 60, 30 );
        stuaddress.setBounds( 70, 150, 160, 30 );

        confirm.setBounds( 70, 220, 70, 30 );
        cancel.setBounds( 180, 220, 70, 30 );
        //把组件添加到面板中
        panel.add( stunameLable );
        panel.add( stuname );
        panel.add( stuageLable );
        panel.add( stuage );
        panel.add( stuphoneLable );
        panel.add( stuphone );
        panel.add( stuaddressLable );
        panel.add( stuaddress );
        panel.add( confirm );
        panel.add( cancel );

    }

    public JPanel getPanel() {
        return panel;
    }
    public void setPanel(JPanel panel) {
        this.panel = panel;
    }
    public JLabel getStunameLable() {
        return stunameLable;
    }
    public void setStunameLable(JLabel stunameLable) {
        this.stunameLable = stunameLable;
    }
    public JLabel getStuageLable() {
        return stuageLable;
    }
    public void setStuageLable(JLabel stuageLable) {
        this.stuageLable = stuageLable;
    }
    public JLabel getStuphoneLable() {
        return stuphoneLable;
    }
    public void setStuphoneLable(JLabel stuphoneLable) {
        this.stuphoneLable = stuphoneLable;
    }
    public JLabel getStuaddressLable() {
        return stuaddressLable;
    }
    public void setStuaddressLable(JLabel stuaddressLable) {
        this.stuaddressLable = stuaddressLable;
    }
    public JTextField getStuname() {
        return stuname;
    }
    public void setStuname(JTextField stuname) {
        this.stuname = stuname;
    }
    public JTextField getStuage() {
        return stuage;
    }
    public void setStuage(JTextField stuage) {
        this.stuage = stuage;
    }
    public JTextField getStuphone() {
        return stuphone;
    }
    public void setStuphone(JTextField stuphone) {
        this.stuphone = stuphone;
    }
    public JTextField getStuaddress() {
        return stuaddress;
    }
    public void setStuaddress(JTextField stuaddress) {
        this.stuaddress = stuaddress;
    }
    public JButton getConfirm() {
        return confirm;
    }
    public void setConfirm(JButton confirm) {
        this.confirm = confirm;
    }
    public JButton getCancel() {
        return cancel;
    }
    public void setCancel(JButton cancel) {
        this.cancel = cancel;
    }
}
